<?php if (!defined('BASEPATH'))exit('No direct script access allowed');
/**
 * 文章控制器
 */
class Content extends MY_Controller {

    function __construct() {
        parent::__construct();
        $this->assign("action", "content");
        $this->load->model('content_model');
    }

    //文章详情页
    function detial($content_id){

        $query_params = "c.id,c.title,c.cate_id,cc.title as cate_name,c.status,c.author,c.thumb,c.summary,c.content,c.order,c.hits,c.out_link,c.create_time,c.update_time";
        $item = $this->db->query("select $query_params from tan_content c left join tan_content_category cc on cc.id = c.cate_id where c.id = $content_id and c.status = 1 order by c.id desc limit 1")->row_array();
        if(!$item){
            $this->display('deleted/index.html');exit;
        }
        $item['create_time'] = $this->set_time_three($item['create_time']);

        $repeat_str = array("<br>",'<p><span style="font-size: 13.3333px;"></span></p>',"<p><br></p>","<p>&nbsp;</p>",'<p><span style="color: rgb(51, 51, 51);">&nbsp;</span></p>','<p><span style="color: rgb(62, 62, 62);">&nbsp;</span></p>','<p><strong><span style="font-size: 10.5pt; color: black;">&nbsp;</span></strong></p>','<p><span style="font-size: 10.5pt; color: black;">&nbsp;</span></p>');
        $item['content'] = str_replace($repeat_str, "", $item['content']);
        $item['content_id'] = $item['id'];
        $item['detail_url'] = site_url("v/".$item['content_id']);

        $this->assign("site_title", $item['title']);
        $this->assign("item", $item);
        $this->display('content/detial.html');
    }

}
